# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>

pkgbase=python-evdev
pkgname=(python-evdev python2-evdev)
pkgver=1.1.2
pkgrel=1
pkgdesc="Python bindings for the Linux input subsystem"
arch=(x86_64)
url="https://python-evdev.readthedocs.io/en/latest/"
license=(BSD)
makedepends=(python python2 git)
_commit=34a7535e8e160c78bf923adc48a1f1f6bcdcaae8  # tags/v1.1.2
source=("$pkgbase::git+https://github.com/gvalkov/python-evdev#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgbase
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cp -a $pkgbase python2
  cp -a $pkgbase python3
}

build() {
  cd python3
  python3 setup.py build

  cd ../python2
  python2 setup.py build
}

package_python-evdev() {
  depends=(python)

  cd python3
  python3 setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -Dt "$pkgdir/usr/share/licenses/python-evdev" -m644 LICENSE
}

package_python2-evdev() {
  depends=(python2)

  cd python2
  python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -Dt "$pkgdir/usr/share/licenses/python2-evdev" -m644 LICENSE
}
